home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Full / Paragon Drive Backup 9 / DB90_SE_x32.msi / Data1.cab / _2F099B30078249CDA2EE592893D1AB7C < prev    next >
Text File  |  2004-02-07  |  10KB  |  432 lines

  1. //    WebHelp 5.10.003
  2. RegisterListener2(this, WH_MSG_GETSTARTFRAME);
  3. RegisterListener2(this, WH_MSG_GETDEFAULTTOPIC);
  4. RegisterListener2(this, WH_MSG_MINIBARORDER);
  5. RegisterListener2(this, WH_MSG_TOOLBARORDER);
  6. RegisterListener2(this, WH_MSG_ISSEARCHSUPPORT);
  7. RegisterListener2(this, WH_MSG_ISSYNCSSUPPORT);
  8. RegisterListener2(this, WH_MSG_ISAVENUESUPPORT);
  9. RegisterListener2(this, WH_MSG_GETPANETYPE);
  10. RegisterListener2(this, WH_MSG_GETPANES);
  11. RegisterListener2(this, WH_MSG_RELOADNS6);
  12. RegisterListener2(this, WH_MSG_GETCMD);
  13. RegisterListener2(this, WH_MSG_GETPANE);
  14. RegisterListener2(this, WH_MSG_GETDEFPANE);
  15.  
  16. if (gbNav6)
  17. {
  18.     var gnReload=0;
  19.     setTimeout("delayReload();",5000);
  20. }
  21.  
  22. function delayReload()
  23. {
  24.     if (!(this.cMRServer && cMRServer.m_strVersion))
  25.     {
  26.         if(gnReload!=2)
  27.         {
  28.             if(nViewFrameType&&nViewFrameType==1)
  29.                 document.location=document.location;
  30.         }
  31.     }
  32. }
  33.  
  34. var gsToolbarOrder = "toc|idx|fts|glo|blankblock|banner";
  35. var gsMinibarOrder = "avprev|avnext|blankblock|hide2|";
  36.  
  37. var gsTopic = "Title.htm";
  38. var PANE_OPT_SEARCH = 1;
  39. var PANE_OPT_BROWSESEQ = 2;
  40. var gnOpts=-1;
  41. var gnCmd=-1;
  42. var gnPans=2;
  43. var gsBtns="invalid";
  44. var gsDefaultBtn="invalid";
  45. var gbHasTitle=false;
  46.  
  47. if (location.hash.length > 1)
  48. {
  49.     var sParam = location.hash;
  50.     if (sParam.indexOf("#<") == 0)
  51.     {
  52.         document.location = "whcsh_home.htm#" + sParam.substring(2);
  53.     }
  54.     else if (sParam.indexOf("#>>") == 0)
  55.     {
  56.         parseParam(sParam.substring(3));
  57.         sParam = "#" + gsTopic + sParam.substring(1);
  58.     }
  59.     else
  60.     {
  61.         var nPos = sParam.indexOf(">>");
  62.         if (nPos>1)
  63.         {
  64.             gsTopic = sParam.substring(1, nPos);
  65.             parseParam(sParam.substring(nPos+2));
  66.         }
  67.         else
  68.             gsTopic = sParam.substring(1);
  69.     }
  70.     if (gnPans == 1 && gsTopic)
  71.     {
  72.         var strURL=location.href;
  73.         if (location.hash)
  74.         {
  75.             var nPos=location.href.indexOf(location.hash);
  76.             strURL=strURL.substring(0, nPos);
  77.         }
  78.         if (gbHasTitle)
  79.             document.location=_getPath(strURL)+ "whskin_tw.htm" + sParam;
  80.         else
  81.             document.location=_getPath(strURL)+ gsTopic;
  82.     }
  83. }
  84.  
  85. function parseParam(sParam)
  86. {
  87.     if (sParam)
  88.     {
  89.         var nBPos=0;
  90.         do 
  91.         {
  92.             var nPos=sParam.indexOf(">>", nBPos);
  93.             if (nPos!=-1)
  94.             {
  95.                 if (nPos>0)
  96.                 {
  97.                     var sPart=sParam.substring(nBPos, nPos);
  98.                     parsePart(sPart);
  99.                 }
  100.                 nBPos = nPos + 2;
  101.             }
  102.             else
  103.             {
  104.                 var sPart=sParam.substring(nBPos);
  105.                 parsePart(sPart);
  106.                 break;
  107.             }
  108.         } while(nBPos < sParam.length);
  109.     }    
  110. }
  111.  
  112. function parsePart(sPart)
  113. {
  114.     if(sPart.toLowerCase().indexOf("cmd=")==0)
  115.     {
  116.         gnCmd=parseInt(sPart.substring(4));
  117.     }
  118.     else if(sPart.toLowerCase().indexOf("cap=")==0)
  119.     {
  120.         document.title=_browserStringToText(sPart.substring(4));
  121.         gbHasTitle=true;
  122.     }
  123.     else if(sPart.toLowerCase().indexOf("pan=")==0)
  124.     {
  125.         gnPans=parseInt(sPart.substring(4));
  126.     }
  127.     else if(sPart.toLowerCase().indexOf("pot=")==0)
  128.     {
  129.         gnOpts=parseInt(sPart.substring(4));
  130.     }
  131.     else if(sPart.toLowerCase().indexOf("pbs=")==0)
  132.     {
  133.         var sRawBtns = sPart.substring(4);
  134.         var aBtns = sRawBtns.split("|");
  135.         for (var i=0;i<aBtns.length;i++)
  136.         {
  137.             aBtns[i] = transferAgentNameToPaneName(aBtns[i]);
  138.         }
  139.         gsRawBtns = aBtns.join("|");
  140.     }
  141.     else if(sPart.toLowerCase().indexOf("pdb=")==0)
  142.     {
  143.         gsDefaultBtn=transferAgentNameToPaneName(sPart.substring(4));
  144.     }
  145. }
  146.  
  147. function setToolbarOrder(sOrder)
  148. {
  149.     gsToolbarOrder = sOrder;
  150. }
  151.  
  152. function setMinibarOrder(sOrder)
  153. {
  154.     gsMinibarOrder = sOrder;
  155. }
  156.  
  157. function onSendMessageX(oMsg)
  158. {
  159.     var nMsgId = oMsg.nMessageId;
  160.     if (nMsgId == WH_MSG_GETSTARTFRAME)
  161.     {
  162.         oMsg.oParam.oFrame = this;
  163.         return false;
  164.     }
  165.     else if (nMsgId == WH_MSG_GETDEFAULTTOPIC)
  166.     {
  167.         if (this.cMRServer && cMRServer.m_strVersion)
  168.         {
  169.             if (cMRServer.m_strURLTopic);
  170.             {
  171.                 oMsg.oParam.sTopic = cMRServer.m_strURLTopic;
  172.                 return false;
  173.             }
  174.  
  175.         }
  176.         oMsg.oParam.sTopic = gsTopic;
  177.         return false;
  178.     }
  179.     else if (nMsgId == WH_MSG_TOOLBARORDER)
  180.     {
  181.         var oMsg1 = new whMessage(WH_MSG_GETPANES, this, 1, null);
  182.         if (SendMessage(oMsg1))
  183.         {
  184.             if (oMsg1.oParam)
  185.             {
  186.                 if (this.cMRServer && cMRServer.m_strVersion)
  187.                 {
  188.                     var aToolbarOrder=cMRServer.m_strAgentList.split(";");
  189.                     var i=0;
  190.                     for (i=0;i<aToolbarOrder.length;i++)
  191.                         aToolbarOrder[i]=transferANToPN2(aToolbarOrder[i]);
  192.                     aToolbarOrder[aToolbarOrder.length] = "blankblock";
  193.                     if (cMRServer.m_bShowSearchInput)
  194.                     {
  195.                         aToolbarOrder[aToolbarOrder.length] = "searchform";
  196.                     }
  197.                     aToolbarOrder[aToolbarOrder.length] = "banner";
  198.                     var aToolbarOrderNew = new Array();
  199.                     for (i=0;i<aToolbarOrder.length;i++)
  200.                     {
  201.                         if (isAPane(aToolbarOrder[i]))
  202.                         {
  203.                             if (oMsg1.oParam.aPanes && oMsg1.oParam.aPanes.length)
  204.                             {
  205.                                 for (var j=0;j<oMsg1.oParam.aPanes.length;j++)
  206.                                 {
  207.                                     if (aToolbarOrder[i] == oMsg1.oParam.aPanes[j].sPaneName)
  208.                                     {
  209.                                         aToolbarOrderNew[aToolbarOrderNew.length] = aToolbarOrder[i];
  210.                                         break;
  211.                                     }
  212.                                 }
  213.                             }
  214.                         }
  215.                         else
  216.                             aToolbarOrderNew[aToolbarOrderNew.length] = aToolbarOrder[i];
  217.                     }
  218.                     oMsg.oParam = aToolbarOrderNew.join("|");
  219.                     return false;
  220.                 }
  221.             }
  222.         }
  223.         var sParam="";
  224.         if (gsBtns!="invalid")
  225.             sParam=gsBtns+"|blankblock|banner";
  226.         else
  227.             sParam = gsToolbarOrder;
  228.  
  229.         if (gnOpts!=-1)
  230.         {
  231.             var nPosForm=sParam.indexOf("|searchform|");
  232.             if (gnOpts&PANE_OPT_SEARCH)
  233.             {
  234.                 if (nPosForm == -1 && sParam.indexOf("|fts|") != -1)
  235.                 {
  236.                     var nPos=sParam.indexOf("banner");
  237.                     if (nPos!=-1)
  238.                     {
  239.                         sParam=sParam.substring(0, nPos) + "searchform|" + sParam.substring(nPos);
  240.                     }
  241.                 }
  242.             }
  243.             else
  244.             {
  245.                 if (nPosForm!=-1)
  246.                 {
  247.                     sParam=sParam.substring(0,nPosForm) + sParam.substring(nPosForm+11);
  248.                 }
  249.             }
  250.         }
  251.         oMsg.oParam=sParam;
  252.         return false;
  253.     }
  254.     else if (nMsgId == WH_MSG_MINIBARORDER)
  255.     {
  256.         var sMinParam=gsMinibarOrder;
  257.         if (gnOpts!=-1)
  258.         {
  259.             var nPosBro=gsMinibarOrder.indexOf("avprev|avnext");
  260.             if (gnOpts&PANE_OPT_BROWSESEQ)
  261.             {
  262.                 if (nPosBro==-1)
  263.                 {
  264.                     sMinParam ="avprev|avnext|" + gsMinibarOrder;
  265.                 }
  266.             }
  267.             else
  268.             {
  269.                 if (nPosBro!=-1)
  270.                 {
  271.                     if (nPosBro!=0)
  272.                         sMinParam=gsMinibarOrder.substring(0, nPosBro) + gsMinibarOrder.substring(nPosBro+14);
  273.                     else
  274.                         sMinParam=gsMinibarOrder.substring(14);
  275.                 }
  276.             }
  277.         }
  278.         oMsg.oParam = sMinParam;
  279.         return false;
  280.     }
  281.     else if (nMsgId == WH_MSG_ISSYNCSSUPPORT)
  282.     {
  283.         if (this.cMRServer && cMRServer.m_strVersion)
  284.         {
  285.             if (cMRServer.m_bShowSync)
  286.                 oMsg.oParam=true;
  287.             else
  288.                 oMsg.oParam=false;
  289.             return false;
  290.         }
  291.         else
  292.         {
  293.             if(typeof(nViewFrameType)!="undefined")
  294.             {
  295.                 oMsg.oParam= (nViewFrameType < 3);
  296.                 return false;
  297.             }
  298.         }
  299.     }
  300.     else if (nMsgId == WH_MSG_ISAVENUESUPPORT)
  301.     {
  302.         if (this.cMRServer && cMRServer.m_strVersion)
  303.         {
  304.             if (cMRServer.m_bShowBrowseSequences)
  305.                 oMsg.oParam=true;
  306.             else
  307.                 oMsg.oParam=false;
  308.         }
  309.         else
  310.         {
  311.             oMsg.oParam=true;
  312.         }
  313.         return false;
  314.     }
  315.     else if (nMsgId == WH_MSG_ISSEARCHSUPPORT)
  316.     {
  317.         if(typeof(nViewFrameType)!="undefined")
  318.         {
  319.             oMsg.oParam= (nViewFrameType < 3);
  320.             return false;
  321.         }
  322.     }
  323.     else if (nMsgId == WH_MSG_GETPANETYPE)
  324.     {
  325.         if(typeof(nViewFrameType)!="undefined")
  326.         {
  327.             var oPaneInfo = new Object();
  328.             oPaneInfo.nType = nViewFrameType;
  329.             oPaneInfo.sPaneURL = strPane;
  330.             oMsg.oParam = oPaneInfo;
  331.             return false;
  332.         }
  333.     }
  334.     else if (nMsgId == WH_MSG_GETPANES)
  335.     {
  336.         if (this.cMRServer && cMRServer.m_strVersion)
  337.         {
  338.             var oPanes = new Object();
  339.             var aAgentNames = null;
  340.             if (cMRServer.m_strDefAgent)
  341.                 oPanes.sDefault = transferAgentNameToPaneName(cMRServer.m_strDefAgent);
  342.  
  343.             aPanes = new Array();
  344.             for(var i=0; i< cMRServer.m_cAgents.length; i++)
  345.             {
  346.                 var nCur = aPanes.length;
  347.                 aPanes[nCur] = new Object();
  348.                 aPanes[nCur].sPaneName = transferAgentNameToPaneName(cMRServer.m_cAgents[i].m_strID);
  349.                 aPanes[nCur].sPaneURL = cMRServer.m_cAgents[i].m_strURL;
  350.             }
  351.             oPanes.aPanes = aPanes;
  352.             oMsg.oParam = oPanes;
  353.             return false;
  354.         }
  355.         else
  356.         {
  357.             oMsg.oParam = null;
  358.             return false;
  359.         }
  360.     }
  361.     else if(nMsgId==WH_MSG_RELOADNS6)
  362.     {
  363.         if(gbNav6)
  364.             gnReload++;
  365.         return false;
  366.     }
  367.     else if(nMsgId==WH_MSG_GETCMD)
  368.     {
  369.         oMsg.oParam=gnCmd;
  370.         return false;
  371.     }
  372.     else if(nMsgId==WH_MSG_GETPANE)
  373.     {
  374.         if (gsBtns!="invalid" && oMsg.oParam.sName)
  375.         {
  376.             if(gsBtns.indexOf(oMsg.oParam.sName) != -1)
  377.                 oMsg.oParam.bEnable=true;
  378.             else
  379.                 oMsg.oParam.bEnable=false;
  380.         }
  381.         else
  382.             oMsg.oParam.bEnable=true;
  383.         return false;
  384.     }
  385.     else if(nMsgId==WH_MSG_GETDEFPANE)
  386.     {
  387.         if (gsDefaultBtn!="invalid")
  388.         {
  389.             oMsg.oParam=gsDefaultBtn;
  390.         }
  391.         return false;
  392.     }
  393.     return true;
  394. }
  395.  
  396. function transferANToPN2(sAN)
  397. {
  398.     if (sAN =="toc")
  399.         return "toc";
  400.     else if    (sAN =="ndx")
  401.         return "idx";
  402.     else if    (sAN =="nls")
  403.         return "fts";
  404.     else if    (sAN =="gls")
  405.         return "glo";
  406.     else if    (sAN =="WebSearch")
  407.         return "websearch";
  408.     else if (sAN.indexOf("custom_")==0);
  409.         return "custom" + sAN.substring(7);
  410.     return sAN;
  411. }
  412.  
  413. function transferAgentNameToPaneName(sAgentName)
  414. {
  415.     if (sAgentName =="toc")
  416.         return "toc";
  417.     else if    (sAgentName =="ndx")
  418.         return "idx";
  419.     else if    (sAgentName =="nls")
  420.         return "fts";
  421.     else if    (sAgentName =="gls")
  422.         return "glo";
  423.     return "";
  424. }
  425.  
  426. function isAPane(sPaneName)
  427. {
  428.     if (sPaneName == "toc" || sPaneName == "idx" || sPaneName == "fts" || sPaneName == "glo")
  429.         return true;
  430.     else
  431.         return false;
  432. }